<%-- 
    Document   : editProduct
    Created on : Apr 9, 2011, 3:25:31 PM
    Author     : Nguyen Hung
--%>

<%@page import="Business.Product"%>
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<%@include file="../WEB-INF/jspf/headeradmin.jspf" %>
       
        <%
                    Product product = (Product) request.getAttribute("product");
                    String productCodeText = "", cpuText = "", ramText = "", hddText = "", cardMonitorText = "", displayText = "";
                    String wirelessText = "", batteryText = "", wightheightText = "", descriptionText = "";
                    String priceText = "", osText = "", dvdText = "", quantityText = "", vendor ="";
                    int warranty = 0;

                    if (product != null) {
                        productCodeText = product.getProductCode();
                        cpuText = product.getCpu();
                        ramText = product.getRam();
                        hddText = product.getHdd();
                        cardMonitorText = product.getCardmonitor();
                        displayText = product.getDisplay();
                        wirelessText = product.getLanwirelessbluetooth();
                        wightheightText = product.getWeightheight();
                        descriptionText = product.getDescription();
                        priceText = product.getPrice() + "";
                        osText = product.getOS();
                        dvdText = product.getOS();
                        batteryText = product.getBattery();
                        quantityText = product.getQuantity() + "";
                        warranty = product.getWarranty();
                        vendor = product.getVendor();
                        
                    }

                    String[] vendors = {"HP-Compacq", "Dell", "Sony", "Lenovo", "Toshiba", "Acer", "Macbook", "Fujitsu", "Gigabyte", "MSI", "Samsung"};
                    int[] array = {6, 12, 24, 36, 48};

        %>


        <form action="">
            <table width="758" border="1">
                <caption>
                    Thông Tin Sản Phẩm
                </caption>
                <tr>
                    <td width="25%">Mã Sản Phẩm (*)</td>
                    <td width="25%"><label>
                            <input type="text" name="productCode" id="productCode" value="<%=productCodeText%>"/>
                        </label></td>
                    <td width="25%">Khối Lượng</td>
                    <td width="25%"><label>
                            <input type="text" name="weighheight" id="weighheight" value="<%=wightheightText%>" />
                        </label></td>
                </tr>
                <tr>
                    <td>CPU</td>
                    <td><label>
                            <input type="text" name="cpu" id="cpu" value="<%=cpuText%>"/>
                        </label></td>
                    <td>Nhà Sản Xuất</td>
                    <td><label>
                            <select name="vendor" id="vendor">                               
                                <% for (int i = 0; i < vendors.length; i++) {%>
                                <option value = “<%=i + 1%>” <%if (vendors[i].equals(vendor)) %>selected="selected" 
                                        ><%= vendors[i]%></option>
                                    <% }%>




                            </select>
                        </label></td>
                </tr>
                <tr>
                    <td>Ram</td>
                    <td><label>
                            <input type="text" name="ram" id="ram"<%=ramText%> />
                        </label></td>
                    <td>Hệ Điều hành</td>
                    <td><label>
                            <input type="text" name="os" id="os"value="<%=osText%>" />
                        </label></td>
                </tr>
                <tr>
                    <td>HDD</td>
                    <td><label>
                            <input type="text" name="hdd" id="hdd" value="<%=hddText%>"/>
                        </label></td>
                    <td>Giá</td>
                    <td><label>
                            <input type="text" name="price" id="price" value="<%=priceText%>"/>
                            VNĐ</label></td>
                </tr>
                <tr>
                    <td>Card Màn Hình</td>
                    <td><label>
                            <input type="text" name="cardmonitor" id="cardmonitor" value="<%=cardMonitorText%>"/>
                        </label></td>
                    <td>DVD - WL</td>
                    <td><label>
                            <input type="text" name="dvd" id="dvd" value="<%=dvdText%>"/>
                        </label></td>
                </tr>
                <tr>
                    <td>Màn Hình</td>
                    <td><label>
                            <input type="text" name="display" id="display" value="<%=displayText%>"/>
                        </label></td>
                    <td>Số Lượng</td>
                    <td><label>
                            <input type="text" name="quantity" id="quantity" value="<%=quantityText%>"/>
                        </label></td>
                </tr>
                <tr>
                    <td>Card Mạng, Wireless</td>
                    <td><label>
                            <input type="text" name="wireless" id="wireless" value="<%=wirelessText%>"/>
                        </label></td>
                    <td rowspan="3">Mô tả sản phẩm</td>
                    <td rowspan="3"><textarea name="description" id="description" cols="45" rows="5" value="<%=descriptionText%>"></textarea></td>
                </tr>
                <tr>
                    <td>Bảo Hành</td>
                    <td><label>
                            <select name="warranty" id="warranty">
                                <% for (int i = 0; i < array.length; i++) {%>
                                <option value = “<%=array[i]%>”
                                        <%if(array[i] == warranty)%> selected
                                        ><%= array[i]%>
                                    <% }%>

                            </select>
                            Tháng
                        </label></td>
                </tr>
                <tr>
                    <td>Battery</td>
                    <td><label>
                            <input type="text" name="battery" id="battery" value="<%=batteryText%>"/>
                        </label></td>
                </tr>
                <tr>
                    <td colspan="2"><label>
                            <input type="submit" name="submit" id="submit" value="Save" />
                        </label></td>
                    <td>&nbsp;</td>
                    <td>&nbsp;</td>
                </tr>
                <tr>
                    <td>&nbsp;</td>
                    <td>&nbsp;</td>
                    <td>&nbsp;</td>
                    <td>&nbsp;</td>
                </tr>
            </table>

        </form>
<%@include file="../WEB-INF/jspf/footeradmin.jspf" %>